// pages/withdrawDetail/withdrawDetail.js
Page({

  /**
   * 页面的初始数据
   */
  data: {

  },
  // 查询钱包
  money: function() {
    var that = this;
    wx.request({
      url: 'https://www.xiaozheng8.com/money/record/findAll',
      data: {
        userId: wx.getStorageSync("userId")
      },
      method: 'post',
      success: function(res) {
        console.log(res);
        that.setData({
          withdrawList: res.data.data.record
        });
        // var price = 0;
        // for (var i = 0; i < that.data.withdrawList.length; i++) {
        //   price = price + that.data.withdrawList[i].money
        // };
        that.setData({
          total: res.data.data.ketixian
        })
      },
      fail: function(res) {},
      complete: function(res) {},
    })
  },
  // 跳转到订单
  detail: function(e) {
    var payId = e.currentTarget.dataset.payid;
    var orderId=e.currentTarget.dataset.orderid;
    wx.navigateTo({
      url: '../withdrawDetailPage/withdrawDetailPage?payId=' + payId+"&orderId="+orderId,
      success: function(res) {},
      fail: function(res) {},
      complete: function(res) {},
    })

  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function(options) {
    this.money();
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function() {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function() {

  }
})